mxufandomcom-20200214-history
About Memcache
What is Memcached? Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages. Memcached Users *LiveJournal *Wikipedia *Flickr *Bebo *Twitter *Typepad *Yellowbot *Youtube *Digg *WordPress.com *Craigslist *Mixi #Membase: supports data persistence (writes them ionicely to disk) and replication (one node dies, you dont lose your key/value pairs). It sends data to disk as fast as it can (while giving priority to getting data back from disk). This is done asynchronously (with an option for synchronous), so clients shouldn't be able to perceive a difference between Membase and memcached data buckets. #Memcached: no persistence or replication. all in memory. I would highly recomend going membase bucket unless you have some I/O concerns (like you get charged for I/O in the cloud). In fact, Couchbase recommends users move to this latest release to take advantage of substantial improvements in the cluster rebalancing process in practice they have not seen much performance difference between the membase and memcached buckets. This is a super cheap way of getting enterprise class HA and scale - 4 data centers (availability zones), "ip failover". Membase and Couchbase data buckets free up memory for new stuff, keeping a hot cache, and memcached data buckets throw something old away. Memcached servers are generally unaware of each other. There is no crosstalk, no syncronization, no broadcasting. The lack of interconnections means adding more servers will usually add more capacity as you expect. There might be exceptions to this rule, but they are exceptions and carefully regarded. What is it Made Up Of? *Client software, which is given a list of available memcached servers. *A client-based hashing algorithm, which chooses a server based on the "key" input. *Server software, which stores your values with their keys into an internal hash table. *Server algorithms, which determine when to throw out old data (if out of memory), or reuse memory. What are the Design Philosophies? Simple Key/Value Store The server does not care what your data looks like. Items are made up of a key, an expiration time, optional flags, and raw data. It does not understand data structures; you must upload data that is pre-serialized. Some commands (incr/decr) may operate on the underlying data, but the implementation is simplistic. Persistent Storage Many users want K/V stores that are able to persist values beyond a restart, or beyond available physical memory. In many cases memcached is not a great fit here; expensive flash memory is needed to keep data access performant. In most common scenarios, disaster can ensue if a server is unavailable and later comes up with old data. Users see stale data, features break, etc. However, with the price of SSD's dropping, this is likely an area to be expanded into. =BeIT Memcached is a client for memcached written in C# 2.0= Membase is a key-value database management system that supports on-the-wire client protocol compatibility with memcached. However unlike memcached it provides disk persistence and data replication. The client supports all memcached commands: *Set *Add *Replace *Append *Prepend *Cas *Get *Multi-Get *Delete *Increment *Decrement *Stats *Flush In addition, it has the following features: *Consistent hashing *Socketpool with configurable size *High-performance *Key prefixing *Compression *Detection of dead servers *Small code-size *Very easy to embed *No external dependencies *No unmanaged code *No background threads *Flexible logging *Implementation follows memcache protocol specifications strictly. difficult to maintain, because it is distributed, when one is taken offline, the db load will go up. Category:memcache